/*
 * lsim.c
 *
 *  Created on: 25/apr/2011
 *      Author: turk2000
 */
#include <math.h>
#include "lsim.h"

float EnlightenmentScore (float CityScore, float DistanceToShrine)
{
	float eScore;

	if (DistanceToShrine > 20)
		return 0;

	return (eScore = CityScore / (DistanceToShrine + 2.0));
}

/* return the construction speed or 0 if error */
float ConstructionSpeed (unsigned level)
{
	float cottage[MAX_BUILDING_LEVEL] = {4.0, 10.0, 16.0, 25.0, 35.0, 46.0, 58.0, 71.0, 85.0, 100};

	if ((1<=level) && (level<=10))
		return cottage[level-1];
	return 0;
}

int ComplexTimeTOunit (unsigned time_h, unsigned time_m, unsigned time_s)
{
	return ((((time_h*60)+time_m)*60)+time_s);
}


int unitSecTOComplexTime (unsigned time, unsigned *time_h, unsigned *time_m, unsigned *time_s)
{
	return 0;
}

/* Ranking for the best resource city. */
int RankResourceCity (int wood, int stone, int iron, int gold, int food)
{
	return (wood+stone+iron+(gold*1.5)+(food*0.5));
}
